$(document).ready(function() {	
	$.cookie('AUTOLOAD_OFFLINE', 1);
	$(window).scroll(function(){			
		if  ($(window).scrollTop() == $(document).height() - $(window).height()){
			loadMine();
		}
	}); 
});
function loadMine() {	
	var intPage = $('#ppage').val();
	var intType = $('#ptype').val();
	if($.cookie('AUTOLOAD_OFFLINE') == 1 && intPage > 0) {		
		$.cookie('AUTOLOAD_OFFLINE',0);	
		$('.boxOffline .loading').show();
		$.getJSON(				
			HOST_VFRIEND + 'ajax/offline?act=4&page='+intPage+'&type='+intType+'&callback=?',		
			function(response) {	
				var msg 	= response['msg'];
				var error	= response['error'];
				if(error == 0) {
					$('#ppage').remove();
					$('#ptype').remove();
					$('.boxOffline .loading').hide();					
					$('.boxOffline ul').append(response['doffline']);
				} else {
					alert(msg);
				}
				$.cookie('AUTOLOAD_OFFLINE', 1);
			}
		);
	}
}